package com.cadre.system.olddomain;


import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import cn.hutool.core.util.RandomUtil;
import com.cadre.common.exception.CadreException;
import com.cadre.common.utils.SecurityUtils;
import com.cadre.common.utils.common.GenerateUUID;
import com.cadre.common.utils.oldutil.FileUtils;
import com.cadre.common.utils.oldutil.PinYinUtil;
import com.cadre.common.utils.oldutil.ResultEnum;
import com.cadre.system.domain.officer.A01;
import com.cadre.system.domain.officer.A04;
import com.cadre.system.domain.officer.A16;
import com.cadre.system.domain.officer.A79;
import org.apache.commons.lang3.ArrayUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.ClassUtils;



/* loaded from: XMLUtils.class */
public class XMLUtils {
    private static String fileName = "干部任免审批表";

    public XMLUtils() {
    }

    public static A01 getA01ByLrmxFile(File file) {
        String temp_xueli_xuexiao = "";
        String temp_xuewei_xuexiao = "";
        String temp_xueli = "";
        String temp_xuewei = "";
        String temp_xueli_xuexiao_zaizhi = "";
        String temp_xuewei_xuexiao_zaizhi = "";
        String temp_xueli_zaizhi = "";
        String temp_xuewei_zaizhi = "";
        SAXReader reader = new SAXReader();
        Document document = null;

        try {
            document = reader.read(file);
        } catch (DocumentException var47) {
            var47.printStackTrace();
        }

        Element root = document.getRootElement();
        List<Element> childElements = root.elements();
        A01 a01Entity = new A01();
        a01Entity.setFlowid(GenerateUUID.getUUID());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
        sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
        Iterator var15 = childElements.iterator();

        String[] temp2;
        Short isout;
        int j;
        label813:
        while(var15.hasNext()) {
            Element child = (Element)var15.next();

            try {
                String var17 = child.getName();
                byte var18 = -1;
                switch(var17.hashCode()) {
                    case -2100347362:
                        if (var17.equals("ChuShengDi")) {
                            var18 = 5;
                        }
                        break;
                    case -2077209702:
                        if (var17.equals("JiGuan")) {
                            var18 = 4;
                        }
                        break;
                    case -2076442519:
                        if (var17.equals("JianLi")) {
                            var18 = 22;
                        }
                        break;
                    case -1763011499:
                        if (var17.equals("QuanRiZhiJiaoYu_XueWei_BiYeYuanXiaoXi")) {
                            var18 = 16;
                        }
                        break;
                    case -1464542954:
                        if (var17.equals("QuanRiZhiJiaoYu_XueWei")) {
                            var18 = 14;
                        }
                        break;
                    case -1367731710:
                        if (var17.equals("ZhaoPian")) {
                            var18 = 11;
                        }
                        break;
                    case -1308666749:
                        if (var17.equals("ZaiZhiJiaoYu_XueLi_BiYeYuanXiaoXi")) {
                            var18 = 19;
                        }
                        break;
                    case -1189511521:
                        if (var17.equals("CanJiaGongZuoShiJian")) {
                            var18 = 7;
                        }
                        break;
                    case -601432990:
                        if (var17.equals("QuanRiZhiJiaoYu_XueLi")) {
                            var18 = 13;
                        }
                        break;
                    case -554439013:
                        if (var17.equals("ZaiZhiJiaoYu_XueWei_BiYeYuanXiaoXi")) {
                            var18 = 20;
                        }
                        break;
                    case -504779652:
                        if (var17.equals("XianRenZhiWu")) {
                            var18 = 21;
                        }
                        break;
                    case -393271276:
                        if (var17.equals("XingBie")) {
                            var18 = 1;
                        }
                        break;
                    case -231281576:
                        if (var17.equals("ZhuanYeJiShuZhiWu")) {
                            var18 = 9;
                        }
                        break;
                    case -190722254:
                        if (var17.equals("JiaTingChengYuan")) {
                            var18 = 25;
                        }
                        break;
                    case -90120319:
                        if (var17.equals("JiangChengQingKuang")) {
                            var18 = 23;
                        }
                        break;
                    case -77740498:
                        if (var17.equals("ShuXiZhuanYeYouHeZhuanChang")) {
                            var18 = 10;
                        }
                        break;
                    case -54429048:
                        if (var17.equals("ChuShengNianYue")) {
                            var18 = 2;
                        }
                        break;
                    case 74347789:
                        if (var17.equals("MinZu")) {
                            var18 = 3;
                        }
                        break;
                    case 90635152:
                        if (var17.equals("ZaiZhiJiaoYu_XueWei")) {
                            var18 = 18;
                        }
                        break;
                    case 421813407:
                        if (var17.equals("ShenFenZheng")) {
                            var18 = 12;
                        }
                        break;
                    case 602634488:
                        if (var17.equals("NianDuKaoHeJieGuo")) {
                            var18 = 24;
                        }
                        break;
                    case 693820415:
                        if (var17.equals("XingMing")) {
                            var18 = 0;
                        }
                        break;
                    case 840303106:
                        if (var17.equals("JianKangZhuangKuang")) {
                            var18 = 8;
                        }
                        break;
                    case 1707398727:
                        if (var17.equals("RuDangShiJian")) {
                            var18 = 6;
                        }
                        break;
                    case 1942586024:
                        if (var17.equals("ZaiZhiJiaoYu_XueLi")) {
                            var18 = 17;
                        }
                        break;
                    case 2116030345:
                        if (var17.equals("QuanRiZhiJiaoYu_XueLi_BiYeYuanXiaoXi")) {
                            var18 = 15;
                        }
                }

                String data_rdsj;
                switch(var18) {
                    case 0:
                        String name1 = child.getText().replaceAll("[^一-龥]", "");
                        a01Entity.setA0101(name1);

                        try {
                            data_rdsj = PinYinUtil.getPingYin(child.getText()).toUpperCase() + "," + PinYinUtil.getFirstSpell(child.getText()).toUpperCase();
                            a01Entity.setA0102(data_rdsj);
                        } catch (Exception var46) {
                        }
                        break;
                    case 1:
                        a01Entity.setA0105(child.getText());
                        break;
                    case 2:
                        try {
                            data_rdsj = child.getText().substring(0, 6);
                            a01Entity.setA0106(sdf.parse(data_rdsj));
                        } catch (Exception var45) {
                        }
                        break;
                    case 3:
                        a01Entity.setA0130(child.getText());
                        break;
                    case 4:
                        a01Entity.setA0108(child.getText());
                        break;
                    case 5:
                        a01Entity.setA0110(child.getText());
                        break;
                    case 6:
                        try {
                            if (child.getText() != "" && child.getText() != null && HasDigit(child.getText())) {
                                data_rdsj = child.getText().substring(0, 6);
                                a01Entity.setA0184(sdf.parse(data_rdsj));
                            }
                        } catch (Exception var44) {
                        }

                        try {
                            if (child.getText() != "" && child.getText() != null) {
                                if (HasDigit(child.getText())) {
                                    data_rdsj = child.getText().replace(".", "").substring(0, 6);
                                    String data_rds = child.getText().replace(".", "");
                                    StringBuilder sb = new StringBuilder(data_rds);
                                    sb.insert(4, ".");
                                    data_rds = sb.toString();
                                    a01Entity.setA0184a(data_rds);
                                } else {
                                    a01Entity.setA0184a(child.getText());
                                }
                            }
                        } catch (Exception var43) {
                        }
                        break;
                    case 7:
                        try {
                            data_rdsj = child.getText().substring(0, 6);
                            a01Entity.setA0138(sdf.parse(data_rdsj));
                        } catch (Exception var42) {
                        }
                        break;
                    case 8:
                        a01Entity.setA0133(child.getText());
                        break;
                    case 9:
                        a01Entity.setA0186(child.getText());
                        break;
                    case 10:
                        a01Entity.setA0152(child.getText());
                        break;
                    case 11:
                        try {
                            if (child.getText() != "" && child.getText() != null) {
                                data_rdsj = child.getText();
                                System.out.println("zhaopian str:" + data_rdsj);
                                a01Entity.setA0171string(data_rdsj);
                            }
                        } catch (Exception var41) {
                        }
                        break;
                    case 12:
                        a01Entity.setA0107(child.getText());
                        break;
                    case 13:
                        temp_xueli = child.getText();
                        break;
                    case 14:
                        temp_xuewei = child.getText();
                        break;
                    case 15:
                        temp_xueli_xuexiao = child.getText();
                        break;
                    case 16:
                        temp_xuewei_xuexiao = child.getText();
                        break;
                    case 17:
                        temp_xueli_zaizhi = child.getText();
                        break;
                    case 18:
                        temp_xuewei_zaizhi = child.getText();
                        break;
                    case 19:
                        temp_xueli_xuexiao_zaizhi = child.getText();
                        break;
                    case 20:
                        temp_xuewei_xuexiao_zaizhi = child.getText();
                        break;
                    case 21:
                        a01Entity.setA0183(child.getText());
                        break;
                    case 22:
                        a01Entity.setA0177(child.getText());
                        a01Entity.setA0177b(child.getText());
                        break;
                    case 23:
                        a01Entity.setA2601(child.getText());
                        break;
                    case 24:
                        a01Entity.setA0195(child.getText());
                        data_rdsj = child.getText();
                        data_rdsj = data_rdsj.replace("；", ";").replaceAll("\\s*|\t|\r|\n", "");
                        temp2 = data_rdsj.split(";");
                        j = 0;

                        while(true) {
                            if (j >= temp2.length) {
                                continue label813;
                            }

                            String line = temp2[j];

                            try {
                                String a1601 = line.substring(0, 4);
                                String a1602 = getA1602(line);
                                A16 a16 = new A16();
                                a16.setFlowid(GenerateUUID.getUUID());
                                a16.setA1601(a1601);
                                a16.setA1602(a1602);
                                a16.setPersonid(a01Entity.getFlowid());
                                a16.setSerial((short)(j + 1));
                                a16.setIsout(Short.valueOf((short)1));
                                a01Entity.getA16List().add(a16);
                            } catch (Exception var40) {
                            }

                            ++j;
                        }
                    case 25:
                        List<Element> jtcy = child.elements();
                        short serial = 1;
                        Iterator var24 = jtcy.iterator();

                        while(var24.hasNext()) {
                            Element child_jt = (Element)var24.next();
                            A79 a79 = new A79();

                            try {
                                String name = child_jt.elementText("XingMing");
                                if (name != null && !"".equals(name)) {
                                    name = name.replaceAll("[^一-龥]", "");
                                    a79.setA7921(name);
                                    a79.setA7910(child_jt.elementText("ChengWei"));
                                    String data_csrq_jt = child_jt.elementText("ChuShengRiQi");

                                    try {
                                        a79.setA7922(sdf.parse(data_csrq_jt));
                                    } catch (Exception var38) {
                                    }

                                    a79.setA7914(child_jt.elementText("ZhengZhiMianMao"));
                                    a79.setA7923(child_jt.elementText("GongZuoDanWeiJiZhiWu"));
                                    a79.setA7931(Long.parseLong(String.valueOf(serial)));
                                    a79.setPersonid(a01Entity.getFlowid());
                                    isout = Short.valueOf((short)1);
                                    a79.setIsout(isout);
                                    a79.setSerial(serial);
                                    ++serial;
                                    a01Entity.getA79List().add(a79);
                                }
                            } catch (Exception var39) {
                            }
                        }
                }
            } catch (Exception var49) {
            }
        }

        List<A04> a04List = new ArrayList();
        List<String> xueli_xuexiao_list = new ArrayList();
        String[] temp1;
        if (temp_xueli_xuexiao != null && !temp_xueli_xuexiao.trim().equals("")) {
             temp1 = temp_xueli_xuexiao.split("  ");

            for(int i = 0; i < temp1.length; ++i) {
                temp1 = temp1[i].split(",");

                for(i = 0; i < temp1.length; ++i) {
                    temp2 = temp1[i].split("，");

                    for(j = 0; j < temp2.length; ++j) {
                        xueli_xuexiao_list.add(temp2[j]);
                    }
                }
            }
        }

        List<String> xuewei_xuexiao_list = new ArrayList();
        temp1 = new String[0];
        int qi;
        if (temp_xuewei_xuexiao != null && !temp_xuewei_xuexiao.trim().equals("")) {
            temp1 = temp_xuewei_xuexiao.split("  ");

            for(int i = 0; i < temp1.length; ++i) {
                temp1 = temp1[i].split(",");

                for(qi = 0; qi < temp1.length; ++qi) {
                    temp1 = temp1[qi].split("，");

                    for(qi = 0; qi < temp1.length; ++qi) {
                        xuewei_xuexiao_list.add(temp1[qi]);
                    }
                }
            }
        }

        List<String> xueli_list = new ArrayList();
        if (temp_xueli != null && !temp_xueli.trim().equals("")) {
            temp1 = temp_xueli.split("、");

            for(int i = 0; i < temp1.length; ++i) {
                temp2 = temp1[i].split(",");

                for(j = 0; j < temp2.length; ++j) {
                    temp1 = temp2[j].split("，");

                    for(qi = 0; qi < temp1.length; ++qi) {
                        xueli_list.add(temp1[qi]);
                    }
                }
            }
        }

        List<String> xuewei_list = new ArrayList();
        int zi;
        if (temp_xuewei != null && !temp_xuewei.trim().equals("")) {
            temp1 = temp_xuewei.split("、");

            for(qi = 0; qi < temp1.length; ++qi) {
                temp1 = temp1[qi].split(",");

                for(qi = 0; qi < temp1.length; ++qi) {
                    temp1 = temp1[qi].split("，");

                    for(zi = 0; zi < temp1.length; ++zi) {
                        xuewei_list.add(temp1[zi]);
                    }
                }
            }
        }

        Map<String, String> mapXueli = new HashMap();
        mapXueli.put("研究生", "11");
        mapXueli.put("本科", "21");
        mapXueli.put("专科", "31");
        mapXueli.put("中专", "4");
        mapXueli.put("中技", "5");
        mapXueli.put("高中", "6");
        mapXueli.put("初中", "7");
        mapXueli.put("小学", "8");

        for(qi = 0; qi < xueli_xuexiao_list.size(); ++qi) {
            A04 a04 = new A04();
            isout = Short.valueOf((short)1);
            a04.setA0449("1");
            if (qi > xueli_list.size() - 1) {
                try {
                    a04.setA0405((String)xueli_list.get(xueli_list.size() - 1));
                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("研究生") || ((String)xueli_list.get(xueli_list.size() - 1)).contains("硕士") || ((String)xueli_list.get(xueli_list.size() - 1)).contains("博士")) {
                        a04.setA0460((String)mapXueli.get("研究生"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("本科") || ((String)xueli_list.get(xueli_list.size() - 1)).contains("大学") && !((String)xueli_list.get(xueli_list.size() - 1)).contains("大学普通")) {
                        a04.setA0460((String)mapXueli.get("本科"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("大专") || ((String)xueli_list.get(xueli_list.size() - 1)).contains("大学普通")) {
                        a04.setA0460((String)mapXueli.get("专科"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("中专")) {
                        a04.setA0460((String)mapXueli.get("中专"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("中技") || ((String)xueli_list.get(xueli_list.size() - 1)).contains("技校")) {
                        a04.setA0460((String)mapXueli.get("中技"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("高中")) {
                        a04.setA0460((String)mapXueli.get("高中"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("初中")) {
                        a04.setA0460((String)mapXueli.get("初中"));
                    }

                    if (((String)xueli_list.get(xueli_list.size() - 1)).contains("小学")) {
                        a04.setA0460((String)mapXueli.get("小学"));
                    }
                } catch (Exception var48) {
                }
            } else {
                a04.setA0405((String)xueli_list.get(qi));
                if (((String)xueli_list.get(qi)).contains("研究生") || ((String)xueli_list.get(qi)).contains("硕士") || ((String)xueli_list.get(qi)).contains("博士")) {
                    a04.setA0460((String)mapXueli.get("研究生"));
                }

                if (((String)xueli_list.get(qi)).contains("本科") || ((String)xueli_list.get(qi)).contains("大学") && !((String)xueli_list.get(qi)).contains("大学普通")) {
                    a04.setA0460((String)mapXueli.get("本科"));
                }

                if (((String)xueli_list.get(qi)).contains("大专") || ((String)xueli_list.get(qi)).contains("大学普通")) {
                    a04.setA0460((String)mapXueli.get("专科"));
                }

                if (((String)xueli_list.get(qi)).contains("中专")) {
                    a04.setA0460((String)mapXueli.get("中专"));
                }

                if (((String)xueli_list.get(qi)).contains("中技") || ((String)xueli_list.get(qi)).contains("技校")) {
                    a04.setA0460((String)mapXueli.get("中技"));
                }

                if (((String)xueli_list.get(qi)).contains("高中")) {
                    a04.setA0460((String)mapXueli.get("高中"));
                }

                if (((String)xueli_list.get(qi)).contains("初中")) {
                    a04.setA0460((String)mapXueli.get("初中"));
                }

                if (((String)xueli_list.get(qi)).contains("小学")) {
                    a04.setA0460((String)mapXueli.get("小学"));
                }
            }

            a04.setPersonid(a01Entity.getFlowid());
            a04.setA0435((String)xueli_xuexiao_list.get(qi));
            a04.setA0411((String)xueli_xuexiao_list.get(qi));
            a04.setIsout(isout);
            a04List.add(a04);
        }

        String xuexiao;
        if (xuewei_xuexiao_list.size() > 0) {
            for(qi = 0; qi < xuewei_xuexiao_list.size(); ++qi) {
                xuexiao = (String)xuewei_xuexiao_list.get(qi);
                boolean isExist = xueli_xuexiao_list.contains(xuexiao);
                if (isExist) {
                    for(qi = 0; qi < a04List.size(); ++qi) {
                        if (((A04)a04List.get(qi)).getA0435().equals(xuexiao)) {
                            try {
                                ((A04)a04List.get(qi)).setA0440((String)xuewei_list.get(qi));
                            } catch (Exception var37) {
                            }
                        }
                    }
                } else {
                    A04 a04 = new A04();
                    isout = Short.valueOf((short)1);
                    a04.setA0449("1");
                    a04.setPersonid(a01Entity.getFlowid());
                    if (qi > xuewei_list.size() - 1) {
                        try {
                            a04.setA0440("");
                        } catch (Exception var36) {
                        }
                    } else {
                        a04.setA0440((String)xuewei_list.get(qi));
                    }

                    a04.setA0435((String)xuewei_xuexiao_list.get(qi));
                    a04.setA0411((String)xuewei_xuexiao_list.get(qi));
                    a04.setIsout(isout);
                    a04List.add(a04);
                }
            }
        } else {
            for(qi = 0; qi < xueli_xuexiao_list.size(); ++qi) {
                xuexiao = (String)xueli_xuexiao_list.get(qi);

                for(qi = 0; qi < a04List.size(); ++qi) {
                    if (((A04)a04List.get(qi)).getA0435().equals(xuexiao)) {
                        try {
                            ((A04)a04List.get(qi)).setA0440((String)xuewei_list.get(qi));
                        } catch (Exception var35) {
                        }
                    }
                }
            }
        }

        List<String> xueli_xuexiao_zaizhi_list = new ArrayList();
        if (temp_xueli_xuexiao_zaizhi != null && !temp_xueli_xuexiao_zaizhi.trim().equals("")) {
            temp1 = temp_xueli_xuexiao_zaizhi.split("  ");

            for(qi = 0; qi < temp1.length; ++qi) {
                temp1 = temp1[qi].split(",");

                for(zi = 0; zi < temp1.length; ++zi) {
                    temp2 = temp1[zi].split("，");

                    for(zi = 0; zi < temp2.length; ++zi) {
                        xueli_xuexiao_zaizhi_list.add(temp2[zi]);
                    }
                }
            }
        }

        List<String> xuewei_xuexiao_zaizhi_list = new ArrayList();
        if (temp_xuewei_xuexiao_zaizhi != null && !temp_xuewei_xuexiao_zaizhi.trim().equals("")) {
            temp1 = temp_xuewei_xuexiao_zaizhi.split("  ");

            for(qi = 0; qi < temp1.length; ++qi) {
                temp1 = temp1[qi].split(",");

                for(int i = 0; i < temp1.length; ++i) {
                    temp2 = temp1[i].split("，");

                    for(zi = 0; zi < temp2.length; ++zi) {
                        xuewei_xuexiao_zaizhi_list.add(temp2[zi]);
                    }
                }
            }
        }

        List<String> xueli_zaizhi_list = new ArrayList();
        if (temp_xueli_zaizhi != null && !temp_xueli_zaizhi.trim().equals("")) {
            temp1 = temp_xueli_zaizhi.split("、");

            for(zi = 0; zi < temp1.length; ++zi) {
                temp2 = temp1[zi].split(",");

                for(zi = 0; zi < temp2.length; ++zi) {
                    String[] temp3 = temp2[zi].split("，");

                    for(int k = 0; k < temp3.length; ++k) {
                        xueli_zaizhi_list.add(temp3[k]);
                    }
                }
            }
        }

        List<String> xuewei_zaizhi_list = new ArrayList();
        if (temp_xuewei_zaizhi != null && !temp_xuewei_zaizhi.trim().equals("")) {
            temp1 = temp_xuewei_zaizhi.split("、");

            for(int i = 0; i < temp1.length; ++i) {
                temp2 = temp1[i].split(",");

                for(zi = 0; zi < temp2.length; ++zi) {
                    String[] temp3 = temp2[zi].split("，");

                    for(int k = 0; k < temp3.length; ++k) {
                        xuewei_zaizhi_list.add(temp3[k]);
                    }
                }
            }
        }

        for(zi = 0; zi < xueli_xuexiao_zaizhi_list.size(); ++zi) {
            A04 a04 = new A04();
            isout = Short.valueOf((short)1);
            a04.setA0449("2");
            if (zi > xueli_zaizhi_list.size() - 1) {
                try {
                    a04.setA0405((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1));
                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("研究生")) {
                        a04.setA0460((String)mapXueli.get("研究生"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("本科")) {
                        a04.setA0460((String)mapXueli.get("本科"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("大专")) {
                        a04.setA0460((String)mapXueli.get("专科"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("中专")) {
                        a04.setA0460((String)mapXueli.get("中专"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("中技")) {
                        a04.setA0460((String)mapXueli.get("中技"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("高中")) {
                        a04.setA0460((String)mapXueli.get("高中"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("初中")) {
                        a04.setA0460((String)mapXueli.get("初中"));
                    }

                    if (((String)xueli_zaizhi_list.get(xueli_zaizhi_list.size() - 1)).contains("小学")) {
                        a04.setA0460((String)mapXueli.get("小学"));
                    }
                } catch (Exception var34) {
                }
            } else {
                a04.setA0405((String)xueli_zaizhi_list.get(zi));
                if (((String)xueli_zaizhi_list.get(zi)).contains("研究生")) {
                    a04.setA0460((String)mapXueli.get("研究生"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("本科")) {
                    a04.setA0460((String)mapXueli.get("本科"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("大专")) {
                    a04.setA0460((String)mapXueli.get("专科"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("中专")) {
                    a04.setA0460((String)mapXueli.get("中专"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("中技")) {
                    a04.setA0460((String)mapXueli.get("中技"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("高中")) {
                    a04.setA0460((String)mapXueli.get("高中"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("初中")) {
                    a04.setA0460((String)mapXueli.get("初中"));
                }

                if (((String)xueli_zaizhi_list.get(zi)).contains("小学")) {
                    a04.setA0460((String)mapXueli.get("小学"));
                }
            }

            a04.setPersonid(a01Entity.getFlowid());
            a04.setA0435((String)xueli_xuexiao_zaizhi_list.get(zi));
            a04.setA0411((String)xueli_xuexiao_zaizhi_list.get(zi));
            a04.setIsout(isout);
            a04List.add(a04);
        }

        if (xuewei_xuexiao_zaizhi_list.size() > 0) {
            for(zi = 0; zi < xuewei_xuexiao_zaizhi_list.size(); ++zi) {
                xuexiao = (String)xuewei_xuexiao_zaizhi_list.get(zi);
                boolean isExist = xueli_xuexiao_zaizhi_list.contains(xuexiao);
                if (isExist) {
                    for(zi = 0; zi < a04List.size(); ++zi) {
                        if (((A04)a04List.get(zi)).getA0435().equals(xuexiao) && ((A04)a04List.get(zi)).getA0449().equals("2")) {
                            try {
                                ((A04)a04List.get(zi)).setA0440((String)xuewei_zaizhi_list.get(zi));
                            } catch (Exception var33) {
                            }
                        }
                    }
                } else {
                    A04 a04 = new A04();
                    isout = Short.valueOf((short)1);
                    a04.setA0449("2");
                    a04.setPersonid(a01Entity.getFlowid());
                    if (zi > xuewei_zaizhi_list.size() - 1) {
                        try {
                            a04.setA0440("");
                        } catch (Exception var32) {
                        }
                    } else {
                        a04.setA0440((String)xuewei_zaizhi_list.get(zi));
                    }

                    a04.setA0435((String)xuewei_xuexiao_zaizhi_list.get(zi));
                    a04.setA0411((String)xuewei_xuexiao_zaizhi_list.get(zi));
                    a04.setIsout(isout);
                    a04List.add(a04);
                }
            }
        } else {
            for(zi = 0; zi < xueli_xuexiao_zaizhi_list.size(); ++zi) {
                xuexiao = (String)xueli_xuexiao_zaizhi_list.get(zi);

                for(zi = 0; zi < a04List.size(); ++zi) {
                    if (((A04)a04List.get(zi)).getA0435().equals(xuexiao) && ((A04)a04List.get(zi)).getA0449().equals("2")) {
                        try {
                            ((A04)a04List.get(zi)).setA0440((String)xuewei_zaizhi_list.get(zi));
                        } catch (Exception var31) {
                        }
                    }
                }
            }
        }

        a01Entity.setA04List(a04List);
        return a01Entity;
    }

    public static File setLrmxFileByA01(List<Map<String, Object>> mapList, boolean isMulti) {
        String data = new SimpleDateFormat("yyyy.MM.dd").format(new Date());
        new FileUtils();
        FileUtils.isOSlinux();
        String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "/temp/lrmx/" + SecurityUtils.getLoginUser().getUserId() + "/";
        System.out.println("basePath:" + basePath);
        File baseDir = new File(basePath);
        if (!baseDir.exists()) {
            baseDir.mkdirs();
        }
        File folder = new File(basePath);
        List<String> files = new ArrayList<>();
        if (!folder.exists()) {
            folder.mkdirs();
        }
        String model = null;
        try {
            model = InputStreamToString(new ClassPathResource("/xml/model.lrmx").getInputStream());
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        try {
            if (isMulti) {
                String zipFileName = basePath + "干部任免审批表[" + data + "_" + RandomUtil.randomInt(3) + "].zip";
                FileOutputStream zipFile = new FileOutputStream(zipFileName);
                List<File> list = new ArrayList<>();
                for (Map<String, Object> map : mapList) {
                    File file = new File(basePath + "干部任免审批表[" + data + "_" + RandomUtil.randomInt(3) + "]_" + map.get("a01_a0101").toString() + ".lrmx");
                    byte[] bs = buildLrmxString(model, map).getBytes("UTF-8");
                    OutputStream out = new FileOutputStream(file);
                    InputStream ins = new ByteArrayInputStream(bs);
                    byte[] buff = new byte[1024];
                    while (true) {
                        int len = ins.read(buff);
                        if (len != -1) {
                            out.write(buff, 0, len);
                        }else{
                            break;
                        }
                    }
                    // TODO 解开注释
                    ins.close();
                    out.close();
                    list.add(file);
                    files.add(file.getAbsolutePath());
                }
                ZipOutputStream zipOutputStream = new ZipOutputStream(zipFile);
                zipFileAll(list, zipOutputStream);
                zipOutputStream.close();
                zipFile.close();
                return new File(zipFileName);
            }
            new ArrayList();
            File file2 = new File(basePath + "干部任免审批表[" + data + "]_" + mapList.get(0).get("a01_a0101").toString() + ".lrmx");
            byte[] bs2 = buildLrmxString(model, mapList.get(0)).getBytes("UTF-8");
            OutputStream out2 = new FileOutputStream(file2);
            InputStream ins2 = new ByteArrayInputStream(bs2);
            byte[] buff2 = new byte[1024];
            while (true) {
                int len2 = ins2.read(buff2);
                if (len2 != -1) {
                    out2.write(buff2, 0, len2);
                } else {
                    ins2.close();
                    out2.close();
                    return file2;
                }
            }
        } catch (IOException e) {
            throw new CadreException(ResultEnum.OFFICE_ERROR);
        }
    }

    private static String buildLrmxString(String model, Map<String, Object> map) {
        return model.replace("${A0101}", getMapValue(map, "a01_a0101")).replace("${A0105}", getMapValue(map, "a01_a0104")).replace("${A0106}", getMapValue(map, "a01_a0107_time")).replace("${A0130}", getMapValue(map, "a01_a0117")).replace("${A0108}", getMapValue(map, "a01_a0111")).replace("${A0110}", getMapValue(map, "a01_a0114")).replace("${A0184}", getMapValue(map, "a01_a0184a")).replace("${A0138}", getMapValue(map, "a01_a0134_time")).replace("${A0133}", getMapValue(map, "a01_a0127")).replace("${A0186}", getMapValue(map, "a01_a0324")).replace("${A0152}", getMapValue(map, "a01_a0187")).replace("${A0187}", getMapValue(map, "a01_a0902")).replace("${A0189}", getMapValue(map, "a01_a0905")).replace("${A0188_1}", getMapValue(map, "a01_a0814")).replace("${A0188_2}", getMapValue(map, "a01_a0814_1")).replace("${A0190}", getMapValue(map, "a01_a0801")).replace("${A0192}", getMapValue(map, "a01_a0901")).replace("${A0191_1}", getMapValue(map, "a01_a0903")).replace("${A0191_2}", getMapValue(map, "a01_a0903_1")).replace("${A0183}", getMapValue(map, "new1002")).replace("${A0177}", getMapValue(map, "a01_a1701")).replace("${A2601}", getMapValue(map, "a01_a1421")).replace("${A0195}", getMapValue(map, "a01_a1511")).replace("${A0171}", getMapValue(map, "a0171_a")).replace("${A0107}", getMapValue(map, "a01_sfz")).replace("${A079s}", getMapValue(map, "familyinfo"));
    }

    /*  JADX ERROR: JadxRuntimeException in pass: BlockProcessor
        jadx.core.utils.exceptions.JadxRuntimeException: Unreachable block: B:12:0x0107
        	at jadx.core.dex.visitors.blocks.BlockProcessor.checkForUnreachableBlocks(BlockProcessor.java:86)
        	at jadx.core.dex.visitors.blocks.BlockProcessor.processBlocksTree(BlockProcessor.java:52)
        	at jadx.core.dex.visitors.blocks.BlockProcessor.visit(BlockProcessor.java:44)
        */
    private static String getMapValue(Map<String, Object> map, String key) {
        try {
            String result = "";
            if (key.equals("a0171_a")) {
                Blob b = (Blob)map.get("a0171_a");
                byte[] bs = b.getBytes(1L, (int)b.length());
                result = Base64.getEncoder().encodeToString(bs);
            } else if (key.equals("familyinfo")) {
                List<Map<String, Object>> familyinfo = (List)map.get("familyinfo");
                StringBuffer sb = new StringBuffer();
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
                Iterator var6 = familyinfo.iterator();

                while(var6.hasNext()) {
                    Map<String, Object> obj = (Map)var6.next();
                    sb.append("<Item>");
                    sb.append("<ChengWei>" + getMapValue(obj, "A7910") + "</ChengWei>");
                    sb.append("<XingMing>" + getMapValue(obj, "A7921") + "</XingMing>");

                    try {
                        sb.append("<ChuShengRiQi>" + simpleDateFormat.format(obj.get("A7922")) + "</ChuShengRiQi>");
                    } catch (Exception var11) {
                        sb.append("<ChuShengRiQi></ChuShengRiQi>");
                    }

                    sb.append("<ZhengZhiMianMao>" + getMapValue(obj, "A7914") + "</ZhengZhiMianMao>");
                    sb.append("<GongZuoDanWeiJiZhiWu>" + getMapValue(obj, "A7923") + "</GongZuoDanWeiJiZhiWu>");
                    sb.append("</Item>");
                }

                result = sb.toString();
            } else if (key.equals("a01_a1701")) {
                try {
                    result = map.get(key).toString();
                    result = result.replace("　", "");
                    result = result.replace("\n                  ", "").replace("\n　　　　　　　　　", "");
                    System.out.println("a01_a1701 result:" + result);
                } catch (Exception var10) {
                    result = "";
                }
            } else {
                try {
                    result = map.get(key).toString();
                } catch (Exception var9) {
                    result = "";
                }
            }

            return result;
        } catch (Exception var12) {
            return "";
        }
    }

    private static void zipFileAll(List files, ZipOutputStream outputStream) {
        Iterator it = files.iterator();
        while (it.hasNext()) {
            zipFile((File) it.next(), outputStream);
        }
    }

    private static void zipFile(File file, ZipOutputStream outputStream) {
        try {
            if (file.exists()) {
                if (file.isFile()) {
                    FileInputStream IN = new FileInputStream(file);
                    BufferedInputStream bins = new BufferedInputStream(IN, 1024);
                    outputStream.putNextEntry(new ZipEntry(file.getName()));
                    byte[] buffer = new byte[1024];
                    while (true) {
                        int nNumber = bins.read(buffer);
                        if (nNumber == -1) {
                            break;
                        }
                        outputStream.write(buffer, 0, nNumber);
                    }
                    outputStream.flush();
                    bins.close();
                    IN.close();
                } else {
                    for (File file1 : file.listFiles()) {
                        zipFile(file1, outputStream);
                    }
                }
            }
        } catch (Exception e) {
            throw new CadreException(ResultEnum.OFFICE_ERROR);
        }
    }

    public static String InputStreamToString(InputStream in) throws IOException {
        StringBuffer out = new StringBuffer();
        byte[] b = new byte[4096];
        while (true) {
            int n = in.read(b);
            if (n == -1) {
                return out.toString();
            }
            out.append(new String(b, 0, n));
        }
    }

    public static String randomHexString(int len) {
        try {
            StringBuffer result = new StringBuffer();
            for (int i = 0; i < len; i++) {
                result.append(Integer.toHexString(new Random().nextInt(16)));
            }
            return result.toString().toUpperCase();
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) throws DocumentException {
        System.out.println(ArrayUtils.contains(new String[]{"优秀", "称职", "合格", "基本称职", "基本合格"}, "2016年年度考核结果是优秀"));
    }

    public File buildZipFile(List<File> fileList, String filePath) throws IOException {
        FileOutputStream zipFile = new FileOutputStream(filePath);
        ZipOutputStream zipOutputStream = new ZipOutputStream(zipFile);
        zipFileAll(fileList, zipOutputStream);
        zipOutputStream.close();
        zipFile.close();
        return new File(filePath);
    }

    public static boolean HasDigit(String content) {
        boolean flag = false;
        if (Pattern.compile("[0-9]").matcher(content).find()) {
            flag = true;
        }
        return flag;
    }

    public static String getA1602(String str) {
        String a1602 = "";
        for (String s : Arrays.asList("优秀", "称职", "合格", "基本称职", "基本合格", "不称职", "不合格", "不定等次", "不进行考核")) {
            if (str.contains(s)) {
                a1602 = s;
            }
        }
        return a1602;
    }
}
